<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>

    $(function () {
        var clinicIndexId = $("#id").val();
        if (clinicIndexId != null && clinicIndexId != "") {
            selectDoctor($("#deptId").val());
        }
    })
    /**
     *  根据科室Id加载医生
     * @param deptId
     */

    function selectDoctor(deptId) {
        $("#doctorInCharge").find("option").remove();
        $.ajax({
            type: "POST",
            url: '${ctx}/sys/orgGroupVsDept/findUserByDeptId?deptId=' + deptId,
            dataType: "json",
            success: function (data) {

                if (data.length > 0) {
                    for (var i = 0; i < data.length; i++) {
                        var user =data[i];
                        $("#doctorInCharge").append('<option value="' + user.id + '">' + user.name + '</option>');
//                        if(user.id==doctorId) {
////                            var obj=$("#selectId").find("option[value="+doctorId+"]");
//                            $("#doctorInCharge").val(doctorId).trigger("change");
//                        }
                    }

                } else {
                    $("#doctorInCharge").find("option").remove();
                    $("#doctorInCharge").append('<option value="">请选择</option>');
                }
            },
            error: function (data) {
                toastr.error('网络连接错误,请检查网络');
            }
        });
    }
</script>
<section class="panel">
    <div class="panel-body">
        <form id="searchForm1" class="form-horizontal">
                <input type="hidden" path="visitNo" value="${liveRequisition.id}"/>
                <input type="hidden" path="clinicId" value="${liveRequisition.clinicId}"/>
            <div class="row">
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">患者姓名：</label>
                        <div class="col-sm-2">
                            <input id="nameDj" name="name" data-parsley-required="true"  value="${liveRequisition.name}" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>

                        <div class="col-sm-2">
                                <sys:select checkValue="${liveRequisition.sex}" lists="${fns:getDictList('SEX_DICT')}" className="form-control" name="sex"></sys:select>
                        </div>
                        <div class="col-sm-2">
                            <div class="input-group mb2">
                            <input name="age" data-parsley-required="true"   data-parsley-type="number"   value="${liveRequisition.age}" htmlEscape="false" class="form-control"  maxlength="40" /><span class="input-group-btn"><button class="btn btn-default" type="button">岁</button></span>
                            </div>
                        </div>
                        <label class="col-sm-2 control-label">建议预交金：</label>
                        <div class="col-sm-2">

                                <input name="paymentAdvice"  value="${liveRequisition.paymentAdvice}" htmlEscape="false" class="form-control"  maxlength="40" />

                            </div>
                    </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">身份证号：</label>
                    <div class="col-sm-4">
                        <input name="idNo" value="${liveRequisition.idNo}" data-parsley-checkidcard="3" htmlEscape="false" class="form-control"  maxlength="40" />
                    </div>
                    <label class="col-sm-2 control-label">出生日期：</label>
                    <div class="col-sm-4">
                        <input name="birthdayDate"  value="<fmt:formatDate value="${liveRequisition.birthdayDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" data-parsley-validate="true" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate form-control" htmlEscape="false"  maxlength="40" />
                    </div>

                </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">婚姻状况：</label>
                    <div class="col-sm-4">
                        <sys:select name="marriage" checkValue="${liveRequisition.marriage}" lists="${fns:getDictList('MARRIAGE_DICT')}" className="form-control"></sys:select>
                    </div>
                    <label class="col-sm-2 control-label">职业：</label>
                    <div class="col-sm-4">
                        <sys:select checkValue="${liveRequisition.occupation}" lists="${fns:getDictList('PROFESSION_DICT')}" className="form-control" name="occupation"></sys:select>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">入院科室：</label>
                    <div class="col-sm-4">
                        <sys:treeselect selectedParent="true" isnull="true" id="orgDeptId"  name="deptAdmissionTo"
                                        value="${liveRequisition.hospitalizedDept}"
                                        update="false"
                                        labelName="${liveRequisition.hospitalizedDept}"
                                        labelValue="${fns:getDeptName(liveRequisition.hospitalizedDept,'')}"
                                        title="科室" url="/sys/orgDept/treeData"
                                        extId="${orgDept.id}" cssClass="form-control" />
                    </div>
                    <input type="hidden" id="deptId" value="${orgDept.deptId}">
                    <label class="col-sm-2 control-label">入院病区：</label>
                    <div class="col-sm-4">
                        <sys:treeselect selectedParent="true" method="selectDoctor" id="wardAdmissionTo" name="wardAdmissionTo"
                                        value="${liveRequisition.wardAdmissionTo}"
                                        update="false"
                                        labelName="${liveRequisition.wardAdmissionTo}"
                                        labelValue="${fns:getDeptName(liveRequisition.wardAdmissionTo,'')}"
                                        title="科室" url="/sys/orgDept/treeData?clinicAttrs=2" isnull="true"
                                        extId="${orgDept.id}" cssClass="form-control" />
                    </div>
                </div>
                <div class="form-group" >

                    <label class="col-sm-2 control-label">发病日期：</label>
                    <div class="col-sm-4">
                        <input path="situationDate" name="situationDate" value="<fmt:formatDate value="${liveRequisition.attackdate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" data-parsley-validate="true" htmlEscape="false" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate form-control"  maxlength="40" />
                    </div>
                    <label class="col-sm-2 control-label">患者费别：</label>
                    <div class="col-sm-4">
                        <sys:select checkValue="${liveRequisition.chargeType}" lists="${fns:getDictList('CHARGE_TYPE_DICT')}" className="form-control" name="chargeType"></sys:select>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">入院情况：</label>
                    <div class="col-sm-4">
                        <sys:select checkValue="${liveRequisition.theIllness}" name="theIllness" lists="${fns:getDictList('ADMISSION_SITUATION_DICT')}" className="form-control" ></sys:select>
                    </div>
                    <label class="col-sm-2 control-label">入院来源：</label>
                    <div class="col-sm-4">
                        <sys:select name="source" checkValue="" lists="${fns:getDictList('RESOURCE_DICT')}" className="form-control"></sys:select>
                    </div>
                </div>

                <div class="form-group" >
                    <label class="col-sm-2 control-label">入院方式：</label>
                    <div class="col-sm-4">
                        <sys:select checkValue="" name="channel" lists="${fns:getDictList('PATIENT_CLASS_DICT')}" className="form-control" ></sys:select>
                    </div>
                    <label class="col-sm-2 control-label">入院时间：</label>
                    <div class="col-sm-4">
                        <input name="admissionDate" data-parsley-required="true" value="<fmt:formatDate value="${liveRequisition.hospitalizedDate}" pattern="yyyy-MM-dd" type="date" dateStyle="long" />" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});" class="form-control Wdate"/>
                    </div>
                </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">门诊诊断：</label>
                    <div class="col-sm-4">
                        <input path="diagnosis" id="icdName" value="${hisDiagnosisDes}"  data-parsley-validate="true" name="diagnosis" htmlEscape="false" class="form-control"  maxlength="40" />
                    </div>
                    <label class="col-sm-2 control-label">接诊医生：</label>
                    <div class="col-sm-4">
                        <select  path="doctorInCharge" id="doctorInCharge" name="doctorInCharge" maxlength="40" class="form-control">
                            <option value="" label=""/>
                        </select>
                    </div>
                </div>
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">国籍：</label>
                        <div class="col-sm-4">
                            <sys:select name="nationality" checkValue="${liveRequisition.nationality}" lists="${fns:getDictList('NATIONALITY_DICT')}" className="form-control"></sys:select>
                        </div>
                        <label class="col-sm-2 control-label">民族：</label>
                        <div class="col-sm-4">
                            <sys:select  name="nation" checkValue="${liveRequisition.nation}" lists="${fns:getDictList('NATION_DICT')}" className="form-control"></sys:select>
                        </div>
                    </div>
                    <div class="form-group" >

                        <label class="col-sm-2 control-label">现住址：</label>
                        <div class="col-sm-4">
                            <input name="address" value="${liveRequisition.address}"  htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>
                        <label class="col-sm-2 control-label">出生地：</label>
                        <div class="col-sm-4">
                            <input name="homeplace" value="${liveRequisition.homeplace}"  htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>

                    </div>
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">合同单位：</label>
                        <div class="col-sm-4">
                            <input name="unitInContract" data-parsley-validate="true" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>

                        <label class="col-sm-2 control-label">所属地区：</label>
                        <div class="col-sm-4">
                            <input name="affiliatingArea" data-parsley-validate="true" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>

                    </div>
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">工作单位：</label>
                        <div class="col-sm-4">
                            <input name="workContract" value="${liveRequisition.unitInContract}" data-parsley-validate="true" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>
                        <label class="col-sm-2 control-label">关系：</label>
                        <div class="col-sm-4">
                            <sys:select checkValue="${liveRequisition.contactsRelation}" name="contactsRelation" lists="${fns:getDictList('RELATIONSHIP_DICT')}" className="form-control" ></sys:select>
                        </div>
                    </div>

                    <div class="form-group" >
                        <label class="col-sm-2 control-label">联系人：</label>
                        <div class="col-sm-4">
                            <input name="contacts" data-parsley-validate="true" value="${liveRequisition.contacts}" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>
                        <label class="col-sm-2 control-label">联系电话：</label>
                        <div class="col-sm-4">
                            <input name="phone" data-parsley-mobilephone="true"  data-parsley-validate="true" value="${liveRequisition.phone}" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>

                    </div>
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">医保登记号：</label>
                        <div class="col-sm-4">
                            <input name="insuranceNo"  data-parsley-twonum="1" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>
                        <label class="col-sm-2 control-label">联系人地址：</label>
                        <div class="col-sm-4">
                            <input name="contactsAddress" value="${liveRequisition.contactsAddress}" data-parsley-validate="true" htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-sm-2 control-label">医保住院登记号：</label>
                        <div class="col-sm-4">
                            <input name="residenceNo" data-parsley-validate="true"  htmlEscape="false" class="form-control"  maxlength="40" />
                        </div>
                    </div>
                <div class="form-group" >
                    <label class="col-sm-2 control-label">备注：</label>
                    <div class="col-sm-10">
                        <textarea path="remarks" name="remarks" data-parsley-validate="true" htmlEscape="false" class="form-control"  maxlength="500" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input id="btnSubmit" class="btn btn-primary" type="button" onclick=" submitSearchForm1('${liveRequisition.clinicId}')" value="保 存">&nbsp;
                        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="loadDiv('mainCenterDiv','${ctx}/doctor/liveRequisition/hospitalRegistr')">
                    </div>
                </div>
            </div>
        </form>
    </div>
</section>
